package com.qdlc.p2p.dal.model;

import java.util.Date;

import org.springframework.beans.BeanUtils;

import com.qdlc.p2p.common.util.Page;
import com.qdlc.p2p.common.util.StringUtil;
import com.qdlc.p2p.dal.dto.BorrowTender;

public class BorrowTenderModel extends BorrowTender {

//	/**
//	 * 投标状态 ： 待处理
//	 */
//	public static final int TENDER_STATUS_TREAT = 0;
//
//	/**
//	 * 投标状态 ： 投资成功
//	 */
//	public static final int TENDER_STATUS_SUCCESS = 1;
//
//	/**
//	 * 投标状态 ： 投资失败
//	 */
//	public static final int TENDER_STATUS_FAIL = 2;
//
//	/**
//	 * 投标状态 ： 已处理
//	 */
//	public static final int TENDER_STATUS_PROCESSED = 3;

	/** 当前页面 */
	private int page = 1;

	/** 每页数据条数 */
	private int size = Page.ROWS;

	/**
	 * 
	 */
	private String uuid;
	/** 借款标ID **/
	private long borrowId;
	/** 借款标名 **/
	private String borrowName;
	/** 借款类型 **/
	private int borrowType;
	/** 实还总金额 **/
	private double accountYes;
	/** 借款总额 **/
	private double account;
	/** 投资人ID **/
	private long userId;
	/** 投资人用户名 **/
	private String userName;
	/** 投资人真实姓名 **/
	private String realName;
	/** 借款人用户名 **/
	private String borrowUserName;
	/** 还款方式 **/
	private int borrowStyle;
	/** 借款标的图片 **/
	private String borrowPicurl;
	/** 借款标的UUID **/
	private String borrowUuid;
	/** 利率 **/
	private double apr;
	/** 总投资 **/
	private double totalTender;
	/** 已回款 **/
	private double yesRepay;
	/** 待收款 **/
	private double waitCollection;
	/** 借款期限 **/
	private int timeLimit;
	/** 预计还款时间 **/
	private int repayTime;
	/** 已经还款时间 **/
	private int repayYesTime;
	/** 预还金额 **/
	private int repayAccount;

	/** 应收开始日期 **/
	private String startTime;
	/** 应收结束开始日期 **/
	private String endTime;
	/** 日期范围：0：全部，1：最近七天 2：最近一个月 3：最近两个月，4 最近三个月 **/
	private int time;

	/** 按投标金额比例(0.1-0.6) **/
	private double partAccount;

	/** 还款结束后奖励 **/
	private double lateAward;
	/** 进度 **/
	private double scales;
	/** 计息起始日 **/
	private Date startDate;
	/** 结束日 **/
	private Date endDate;
	/** 待还期数 **/
	private int period;
	/** 条件查询 */
	private String searchName;
	/** 手动上传合同路径 */
	private String contractPath;
	/** 标时间类型 0月标 1天标 */
	private int borrowTimeType;
	/** 借款人手机号码 */
	private String mobilePhone;
	/**
	 * 加息收益
	 */
	private double upInterest;

	/**
	 * 加息幅度
	 */
	private double upApr;

	/**
	 * 使用体验金金额
	 */
	private double useExperMoney;

	/**
	 * 使用红包金额
	 */
	private double useRadMoney;

	/**
	 * 体验券投标金额
	 */
	private double experienceTenderAccount;
	
	/**
	 * 1：普通标 0：新手标 2:体验标
	 */
	private int category;

	public String getBorrowNameHide() {
		if (StringUtil.isNotBlank(borrowName) && (borrowName.length() > 7)) {
			return borrowName.substring(0, 6) + "***";
		}
		return "";
	}

	public static BorrowTenderModel instance(BorrowTender borrowTender) {
		BorrowTenderModel model = new BorrowTenderModel();
		BeanUtils.copyProperties(borrowTender, model);
		return model;
	}

	public int getPage() {
		return page;
	}

	public void setPage(int page) {
		this.page = page;
	}

	public int getSize() {
		return size > 0 ? size : Page.ROWS;
	}

	public void setSize(int size) {
		this.size = size;
	}

	public long getBorrowId() {
		return borrowId;
	}

	public void setBorrowId(long borrowId) {
		this.borrowId = borrowId;
	}

	public String getBorrowName() {
		return borrowName;
	}

	public void setBorrowName(String borrowName) {
		this.borrowName = borrowName;
	}

	public double getAccountYes() {
		return accountYes;
	}

	public void setAccountYes(double accountYes) {
		this.accountYes = accountYes;
	}

	@Override
	public double getAccount() {
		return account;
	}

	@Override
	public void setAccount(double account) {
		this.account = account;
	}

	public String getUserName() {
		return userName;
	}

	public void setUserName(String userName) {
		this.userName = userName;
	}

	public String getRealName() {
		return realName;
	}

	public void setRealName(String realName) {
		this.realName = realName;
	}

	public int getBorrowStyle() {
		return borrowStyle;
	}

	public void setBorrowStyle(int borrowStyle) {
		this.borrowStyle = borrowStyle;
	}

	public int getTimeLimit() {
		return timeLimit;
	}

	public void setTimeLimit(int timeLimit) {
		this.timeLimit = timeLimit;
	}

	public int getRepayTime() {
		return repayTime;
	}

	public void setRepayTime(int repayTime) {
		this.repayTime = repayTime;
	}

	public int getRepayYesTime() {
		return repayYesTime;
	}

	public void setRepayYesTime(int repayYesTime) {
		this.repayYesTime = repayYesTime;
	}

	public int getRepayAccount() {
		return repayAccount;
	}

	public void setRepayAccount(int repayAccount) {
		this.repayAccount = repayAccount;
	}

	public String getStartTime() {
		return startTime;
	}

	public void setStartTime(String startTime) {
		this.startTime = startTime;
	}

	public String getEndTime() {
		return endTime;
	}

	public void setEndTime(String endTime) {
		this.endTime = endTime;
	}

	public double getLateAward() {
		return lateAward;
	}

	public void setLateAward(double lateAward) {
		this.lateAward = lateAward;
	}

	public double getScales() {
		return scales;
	}

	public void setScales(double scales) {
		this.scales = scales;
	}

	public double getPartAccount() {
		return partAccount;
	}

	public void setPartAccount(double partAccount) {
		this.partAccount = partAccount;
	}

	public String getBorrowUserName() {
		return borrowUserName;
	}

	public void setBorrowUserName(String borrowUserName) {
		this.borrowUserName = borrowUserName;
	}

	public int getTime() {
		return time;
	}

	public void setTime(int time) {
		this.time = time;
	}

	public long getUserId() {
		return userId;
	}

	public void setUserId(long userId) {
		this.userId = userId;
	}

	public double getApr() {
		return apr;
	}

	public void setApr(double apr) {
		this.apr = apr;
	}

	public double getTotalTender() {
		return totalTender;
	}

	public void setTotalTender(double totalTender) {
		this.totalTender = totalTender;
	}

	public double getYesRepay() {
		return yesRepay;
	}

	public void setYesRepay(double yesRepay) {
		this.yesRepay = yesRepay;
	}

	public double getWaitCollection() {
		return waitCollection;
	}

	public void setWaitCollection(double waitCollection) {
		this.waitCollection = waitCollection;
	}

	public Date getStartDate() {
		return startDate;
	}

	public void setStartDate(Date startDate) {
		this.startDate = startDate;
	}

	public Date getEndDate() {
		return endDate;
	}

	public void setEndDate(Date endDate) {
		this.endDate = endDate;
	}

	public int getPeriod() {
		return period;
	}

	public void setPeriod(int period) {
		this.period = period;
	}

	public String getStatusString() {
		if (getStatus() == 0) {
			return "投资待处理";
		} else if (getStatus() == 1) {
			return "投资成功";
		} else if (getStatus() == 2) {
			return "投资失败";
		} else if (getStatus() == 3) {
			return "投资已处理";
		} else {
			return "错误的状态码";
		}
	}

	public String getSearchName() {
		return searchName;
	}

	public void setSearchName(String searchName) {
		this.searchName = searchName;
	}

	public String getContractPath() {
		return contractPath;
	}

	public void setContractPath(String contractPath) {
		this.contractPath = contractPath;
	}

	public double getUpInterest() {
		return upInterest;
	}

	public void setUpInterest(double upInterest) {
		this.upInterest = upInterest;
	}

	public String getUuid() {
		return uuid;
	}

	public void setUuid(String uuid) {
		this.uuid = uuid;
	}

	public double getUpApr() {
		return upApr;
	}

	public void setUpApr(double upApr) {
		this.upApr = upApr;
	}

	public double getExperienceTenderAccount() {
		return experienceTenderAccount;
	}

	public void setExperienceTenderAccount(double experienceTenderAccount) {
		this.experienceTenderAccount = experienceTenderAccount;
	}

	public double getUseExperMoney() {
		return useExperMoney;
	}

	public void setUseExperMoney(double useExperMoney) {
		this.useExperMoney = useExperMoney;
	}

	public double getUseRadMoney() {
		return useRadMoney;
	}

	public void setUseRadMoney(double useRadMoney) {
		this.useRadMoney = useRadMoney;
	}

	public int getBorrowType() {
		return borrowType;
	}

	public void setBorrowType(int borrowType) {
		this.borrowType = borrowType;
	}

	public int getBorrowTimeType() {
		return borrowTimeType;
	}

	public void setBorrowTimeType(int borrowTimeType) {
		this.borrowTimeType = borrowTimeType;
	}

	public String getBorrowPicurl() {
		return borrowPicurl;
	}

	public void setBorrowPicurl(String borrowPicurl) {
		this.borrowPicurl = borrowPicurl;
	}

	public String getBorrowUuid() {
		return borrowUuid;
	}

	public void setBorrowUuid(String borrowUuid) {
		this.borrowUuid = borrowUuid;
	}

	public int getCategory() {
		return category;
	}

	public void setCategory(int category) {
		this.category = category;
	}

	public String getMobilePhone() {
		return mobilePhone;
	}

	public void setMobilePhone(String mobilePhone) {
		this.mobilePhone = mobilePhone;
	}
}
